#ifndef TRACKERDEVICE_H
#define TRACKERDEVICE_H

/**
 * Copyright: (C) 2011 RobotCub Consortium
 * @author Gabriel Baud-Bovy
 * @author Mike Ciaraldi
 * CopyPolicy: Released under the terms of the LGPLv2.1 or later, see LGPL.TXT
 *
 * Wrapper class for Motion Trackers 
 */


#include <yarp/os/all.h>
#include <yarp/sig/all.h>
#include <yarp/dev/all.h>


#define TRACKER_POLLING				0	// polling
#define TRACKER_STREAMING			1	// continuous (overwrite warning)
#define TRACKER_STREAMING_LATEST	2	// continuous  

#include "Tracker.h"

using namespace yarp::os;
using namespace yarp::sig;
using namespace yarp::dev;

class TrackerDevice : 
  public yarp::dev::IGenericSensor,
  public yarp::dev::DeviceDriver {

public:
  TrackerDevice();

  virtual bool open(yarp::os::Searchable& config);

  /** Close the device
   * @return true if success, false if not
   */
  virtual bool close();

  /** Read a vector from the sensor.
   * @param out a vector containing the sensor's last readings.
   * @return true/false success/failure
   **/
  virtual bool read(yarp::sig::Vector &out);

  /** Get the number of channels of the sensor.
   * @param nc pointer to storage, return value
   * @return true/false success/failure
   */
  virtual bool getChannels(int *nc);

  /** Calibrate the sensor, single channel.
   * @param ch channel number
   * @param v reset valure
   * @return true/false success/failure
   */
  virtual bool calibrate(int ch, double v);

  char *getErrorInfo(void);
 private:
   Tracker *tracker; // Pointer to the actual tracker device
   int acquisitionType;
   double  *calibParam; // Parameters for mapping tracker base reference system into the robot one
};

#endif
